You can get information about python in the Python documentation webpage. These pages are superbly well written, and have adapted information to pretty much any level, from beginners to more advanced users.
We will use Python 2.7, whose documentation can be found here. Usually, results from a search engine for functions within python will guide you these pages, so it would be a good idea if you familiarise yourself with them.
The Python documentation has a section called "Python Enhancement Proposals" (PEPs), which contain very general information about various topics. Some of them might have information most scientific users do not care about. But there are several notable ones, amongst which:
Apart from the tutorial of the Level 1 and Level 2 labs, we also recommend taking a look at the tutorial offered by the python guys.
The easiest way of getting information is using the internet.
Any search engine will spit out several hundred millions pages worth of information if you search for python help
. Obviously, looking in the documentation pages of the particular module you are using would help. Some of these pages are:
These often offer tutorials on different topics, but most of these should be taken as reference pages, in case you want specific information about the contents of different modules, submodules, data types or functions (all of which, in reality, are treated as objects in Python).
If you do not have access to the internet, Don't panic! Most packages (like matplotlib, scipy,...) have been created by people with good documentation skills, or have had to pass some sort of "quality" standard which prompts them to document their code [link here]. Therefore, these packages will come with a complete documentation, usually in the form of docstrings in the scripts.
To access these, you only need to type help(Stuff)
in the console and python will look for the docstrings pertaining to this topic or function. The following code will show the information available for the function max
in numpy:
In [1]:
from numpy import max as maxi #The name is changed to keep the builtin MAX function
help(maxi)
Note that this function is different from the builtin max
function.
In [2]:
help(max)
If help
is used on modules, it shows the different submodules, data types and functions it contains, often giving more detailed information about their contents.
One of the best things about Python is the tremendous user base, which provides with questions and answers about the problems they encounter with the language. These are a invaluable resource, as they push the knowledge of python from the "general information" given by manuals and tutorials to the specific case uses.
They usually do this in forums, mailing lists or places like StackOverflow.
Looking for information in these places is a very valid resource, as you should not waste time in problems that have already been solved elsewhere; furthermore, reading someone else's code will help you in your own coding practice. You should be wary, though, as many solutions to problems are quick-and-dirty approaches to problems.
However, posting new questions in these places should be used as the last resort for information, when the manual and search engines have not been your friends (see RTBM).
Finally, if you find a solution to one of the problems that you have stumbled upon with no solution on the web, please consider documenting it by posting the answer in the internet. The world will become a better place.